Passed
Push — master ( 1adf40...f067da )
by lv
01:05
created

module.exports.getUserByOpenId   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
dl 11
loc 11
rs 10
nop 1
1 View Code Duplication
const DB = require('../libraries/db')
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
const ModelBase = require('./base')
3
4
let table = 'fc_users'
5
6
7
module.exports = {
8
9
	getUserByOpenId: async function (openid) {
10
11
		let user = DB.readMysql.first(
12
			'*'
13
		)
14
			.from(table)
15
			.where('openid', openid)
16
17
		return await user
18
19
	},
20
21
	getUser: async function (uid) {
22
23
		let user = DB.readMysql.first(
24
			'*'
25
		)
26
			.from(table)
27
			.where('id', uid)
28
29
		return await user
30
31
	},
32
33
	addUser: async function (data) {
34
		let result = await ModelBase.execInsert(table, data)
35
36
		return await result
37
	},
38
39
	editUser: async function (data, where, notWhere = {}) {
40
		let result = await ModelBase.execUpdate(table, data, where, notWhere)
41
42
		return await result
43
	}
44
45
}